#!/bin/bash

# 获取环境变量或使用默认值
HOST=${MYSQL_HOST:-"db"}
PORT=${MYSQL_PORT:-3306}

echo "Waiting for mysql..."

while ! nc -z $HOST $PORT; do
  sleep 1
  echo "Waiting for mysql at $HOST:$PORT..."
done

echo "MySQL started at $HOST:$PORT"
